/* Bootstrap p. values for marginal effects */

*Install boottest if necessary
*Copy the p-values from the following models and include them in R

clear all
estimates clear

global dopath "C:/Users/bogdanp/Dropbox/Legacies_Central_Europe"
*global dopath "/Users/bgpopescu/Dropbox/Legacies_Central_Europe"
use "$dopath/data/nuts_data.dta", clear

egen ctrnum1 = group(ctrnum)
quietly reg lngdpcap c.p_ottoman##c.yearpos tavg lograin logelev logslope wheat_rainfed log_sea_lines_distance log_large_rivers_distance point_x point_y i.ctrnum1 if (otthist==1), cluster(ctrnum1)
margins, dydx(p_ottoman) at(yearpos = 1650)
boottest, margins  cluster(ctrnum1) nonull nograph seed(1234)

quietly reg lngdpcap c.p_ottoman##c.yearpos tavg lograin logelev logslope wheat_rainfed log_sea_lines_distance log_large_rivers_distance point_x point_y i.ctrnum1 if (otthist==1), cluster(ctrnum1)
margins, dydx(p_ottoman) at(yearpos = 1700)
boottest, margins  cluster(ctrnum1) nonull nograph reps (9999) seed(1234)

quietly reg lngdpcap c.p_ottoman##c.yearpos tavg lograin logelev logslope wheat_rainfed log_sea_lines_distance log_large_rivers_distance point_x point_y i.ctrnum1 if (otthist==1), cluster(ctrnum1)
margins, dydx(p_ottoman) at(yearpos = 1750)
boottest, margins  cluster(ctrnum1) nonull nograph reps (9999) seed(1234)
